
{extend name='public/base' /}

{block name="content"}

<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body" style="padding: 15px;">
            <form class="layui-form" action="" lay-filter="form">
                <input type="hidden" name="id" value="{$info.id}">
                <div class="layui-form-item">
                    <label class="layui-form-label">待缴账单金额</label>
                    <div class="layui-input-block">
                        <input type="number" name="amount" value="{$info.amount/100}" disabled autocomplete="off" placeholder="请输入需缴金额" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">待缴费列表：</label>
                    <div class="layui-input-block">
                        <table class="layui-table">
                            <thead>
                            <tr>
                                <td>商户名</td>
                                <td>费用项名称</td>
                                <td>缴费周期</td>
                                <td>账单金额</td>
                            </tr>
                            </thead>
                            <tbody class="role_list">
                            {foreach $list as $key=>$id}
                            <tr>
                                <td>{$id['merchants']['name']}</td>
                                <td>{$id['costType']['cost_name']}</td>
                                <td>{$id['start_time']}-{$id['end_time']}</td>
                                <td>{$id['amount']/100}</td>
                            </tr>
                            {/foreach}
                            </tbody>

                        </table>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label label-required-next">凭证：</label>
                    <div class="layui-input-block">
                        <div class="layui-upload-drag" id="editimg">
                            <img id="show_id" onclick="previewImg(this)" style="width: 260px;margin: 10px 0 10px 0px;height: 150px" src="{$info.other_certificate}" alt="上传附件" width="120" height="120">
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">缴费银行账号</label>
                    <div class="layui-input-block">
                        <input type="text"  value="{$info.back_number}" disabled autocomplete="off" placeholder="" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">商户输入缴费金额</label>
                    <div class="layui-input-block">
                        <input type="text"  value="{$info.in_amount/100}" disabled autocomplete="off" placeholder="" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">缴费日期</label>
                    <div class="layui-input-block">
                        <input type="text"  value="{$info.up_time}" disabled autocomplete="off" placeholder="" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">备注</label>
                    <div class="layui-input-block">
                        <textarea placeholder="请输入内容" class="layui-textarea" name="remark"></textarea>
                    </div>
                </div>
                <div class="layui-form-item layui-layout-admin " style="width: 100%">
                    <div class="layui-input-block">
                        <div class="layui-footer" style="left: 0px;text-align: center;">
                            <button class="layui-btn" lay-submit="" lay-filter="confirm">通过</button>
                            <button class="layui-btn layui-btn-danger" lay-submit=""  lay-filter="cancel">不通过</button>
                        </div>
                    </div>
                </div>

            </form>
        </div>
    </div>
</div>

{/block}

{block name="js"} <!--js处理区-->


<script>
    layui.use(['element', 'table', 'form', 'jquery', 'lucky','opTable'], function () {
        var element = layui.element;
        var form = layui.form;
        var $ = layui.jquery;
        var lucky=layui.lucky;
        var opTable = layui.opTable;
        var table = layui.table;
        form.render();
        //通过
        form.on('submit(confirm)', function (data) {
            // console.log(data.field)
            data.field.pay_status = 1;
            lucky.FormSubmit("{:url('UpdateCost')}",data.field,true);
            return false;
        });
        //不通过
        form.on('submit(cancel)', function (data) {
            // console.log(data.field)
            data.field.pay_status = 0;
            lucky.FormSubmit("{:url('UpdateCost')}",data.field,true);
            return false;
        });
    });
    function previewImg(url){
        console.log(url.src);
        var imgHtml = "<img src='" + url.src + "' width='100%' height='100%'/>";
        //弹出层
        layer.open({
            type: 1,
            shade: 0.8,
            offset: ['top:10px'],
            area: [600 + 'px', 700 + 'px'],
            shadeClose: true,
            scrollbar: false,
            title: "图片预览",
            content: imgHtml,
            cancel: function () {

            }
        });
    }
</script >

{/block}
